moved sorting to different place