original July 2008 code