Dbatiste/factoring

Merging changes to date.  More tests to follow.