backing up

works for the first loop doesn't sort anything after that