simplify some code places