remove unnecessary code,better design