reorganized the projection function