Mattupstate factory fix

This is the factory fix created by @mattupstate originally detailed in #130. Moved it to origin to expedite fixing any merge conflicts.