added sorting solution