Using CGRects instead of NSRects to support both OSX and iOS