simplify the function