[WIP] Refactoring

Work in progress but I wanted to discuss few points, so better to do it here.