refactor
refactor for OOP implemention