Refactor, remove unnecessary code