Refactor to make more OO