log should now be closer to simplest form during simplification; added integer decomposition to it.