simplify some code