major refactorisation