refactored simplify method