Beamline optimization and phase space transformationa)