Updated for Firefox compatability