typos and optimisations