tweaked for cross-browser-capability