second try. trying not to use accelerate.h