Fixed previous stage and added new one with sorting