Some code reorganisation.