Cleaned up implementation
Added a simple test
Added javadoc and refactored Comparator class name
Fixed scope problem