Refactor to OO design