Remove redundant operations in the get_all... for loop