deleted repeats, simplify code

deleted repeats, simplify code