refactor to OO design