Remove unused code, improve code coverage