Almost have simplification code working