empty checks for null too
move sort to both methods