sorting based on params