Fix spelling, code and formatting inconsistencies