last version of working code (Aug 21, 2013)