Code cleanup

Improved consistency, indentation and spell check.