revised version of code