Made some minor optimisations.