updated to Objective-C ARC
parameterize scope value
updated sample based on recent changes