added sorting fixes #3

Awesome job! Go ahead and merge this back into master.