tidied up slightly