Tidying up

Tidied some code up to improve readability