added a so-so factoring function.  let's see how this changes things.