code updated 11/28/2013