Changes to make it compatible with iOS and Mac