Started work on factor.h/cpp unit tests