We present an extremely compact wavelength division multiplexer design, as well as a general framework for designing and optimizing frequency selective devices embedded in photonic crystals satisfying arbitrary design constraints. Our method is based on the Dirichlet-to-Neumman simulation method and uses low rank updates to the system to efficiently scan through many device designs.