Added functions to macgril.js