Tidied up code
x