Fixing function syntax to increase portability