Logic simplification