Move mappers/loaders to their own file and fix a bug with Directives