a little bit of tidying up
changed types to private since they're not used outside of this module