faffing!  More optimisation needed