More refactoring to a simpler code organisation