updated with result looping and new result data