rework lab5, delelte many useless variables and function