small refactoring, making classes package private and addingi finalizations