optimization and simplification