refactor to oo