Improved coding style & global fixes