intermediary work
Modified script to support Safari