add and revise some codes