Refactor algorithm state in simpdiv.