Updated code from Dec. 30th