more rewriting to get this #@!#@!&*( Mac OSX GPU to work