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 
Again, not the point of this change.  I think it should be left. You're welcome to make a pull request removing #Id from the codebase though, Radu.