Tidied up some code.