Factor -objectAtIndex: into a method