Minor code reorganisation