Added minor optimisations.