Tidied up code, commented settings better.