Remove last vestige of IsMain
Replace file metadata object with filename/directory in type metadata objects
Move utility functions to start of file, where they belong