changed rect to sharedptr