Initial implementation of factory generation