Code style fixes, comment fixes, refactoring