Fixes

Coding style fixes. Remove duplicated or unnecessary code.