refactor into an oop structure