Tidied up some unused variables, etc.