realised i'd done all the coding in another function