Implement most basic factory.def() and factory.gen() methods