Tidied up as much as possible before the human stylecop looks at it