Tidied up code, removed comments.