refactor all to use oo