Planar optical elements based on sub-wavelength quasi-periodic structures enable excellent control of the phase and amplitude of free-space optical fields. These structures consist of two-dimensional patterns etched directly in a thin layer of material with a high index of refraction (such as silicon). The unprecedented phase control provided by these nano-patterns allows for simple implementation of arbitrary phase masks. These phase masks can be fabricated using standard micro-fabrication techniques and can be easily cascaded to realize complete control over the beam shape. I will present theory and design methods we developed for determining the optimum phase masks for coupling the light from one waveguide to another. I will also discuss the simulation method for the design of quasi-periodic structures, and present simulation results and our approach for integrating these nano-structures on tip of optical fibers.