simplify the code.