made the code play nicer with Firefox and Safari