Fixed up formatting and style

Made a load of variable names more descriptive and in line wiht the coding standards.

A load of abmiguous If and swtich statements have been made less so.

Removed my comment notes that weren't needed any more.

Refs #7865