refectoring to be oop