Added more flexibility to g-method used by pollard rho, to make sure all factorizations are successful. Now it should be working, but its very slow.
Extracted g to a new class, that can be instantiated with the apropriate parameters.