Sorting via priority. Update 1/3