implemented oop rewrite