Move def out of the loop, remove bool.