Tidied up code from inspection.