Complete refactoring towards to a clean decoupled architecture