add tests and comparator; first impl