Clarify numcomparisons usage
Move code to put similar code closer together
Various code clean-up, comments and refactoring