dbc refactoring procedural into oo js