A cleaned up ARC version of apples sample code