working code Nov 12 2014