Change sort representation to class

- changed sort representation from String to class
- modified API's accordingly
- replaced string literals with constants
- cleaned up a lot of mess 
that's perhaps a better question but changing the behavior of  code is outside the scope of the pull request. I'd suggest deprecating one or the other of  them and then leaving it.