Lots of tidy up, moving "top-level" types to package object