Cleaning up parts of code to make it more readable; refs #7