Updated Safari code to work with latest changes