File rename; minor code reorganisation