delete duplicate if statement
Simplify some methods