raised test coverage + some minor code changes