factor the code