Fix style and remove unused code

This pull request fixes a number of style issues and removes unused code.