Initial factoring and test