Updated by replacing loop with valueForKeyPath: