implemented sorting methods