minor code reorganisation