fixed sorting
better syntax
fixing if statement
adding a default sort field just in case
fixing sorting
Merge pull request #768 from tarunc/sorting-issues

Sort it out