Refactor all the codes!