copying in willin code from sission 4