Initial porting to Mac