add new tests, add unit tests, add new factnor function