Updated for more modern browsers