Tidied up code and corrected indentations