GCI-9 #2

Fixed in this pull:
- compareTo methods now have complementary equals() methods
- database resources closed properly.