code refactorisation for controls