Came up with alternative solution to sorting