latest version of code from Griff