working on refactoring towards a more OO-based approach