added mac os functionality with global variables