code improvements, test coverage