Function properly when flag is used