some improvements for future optimisations.