move bootstrapping code out of loader into src proper