[WIP] started refactoring