refactor to OO-design