update code from sitepoint