simplification and optimization