Changes to make it work on iOS