working on OO version