Fix some coding style and unused code