Increasing unit test coverage & fixing bugs