simplify some codes