made to work better in older IE. added comments to code