more code reorganisation