fixed typo
refactor
added sort() utility