some minor optimisations