Tidied up some file handles, added part sub class