Two-Phase Galaxy Formation