optimisations to references etc