Rewrite functions to handle sort() command in query
Make code clearer
Merge pull request #29 from macworld/master

Rewrite functions to handle sort() command in query