Improved coding style and documentation