Updated by replacing loop with valueForKey: