Cleanup code style and remove deprecated or commented out code