optmisations and improvements