simplify previous 2 functions