[Refactoring] A big refactoring