updated to match objective-c version