rewrite the framework in OOP thinking