tidied up code final