Done some little refactoring; gone through the code to fix some indentation.