implemented factory and fixed up a bug in the config routines
implemented arithmetic generation