now using typedef
fixed crashing on OSX