reorganized + added test coverage