added Tim's functions - all working