Initial working Objective-C implementation.