Updating the handleOpenURL function