tidied/fixed, with jon's methods