pull id-grabbing logic out into seperate method