final sort task solution