Instead of using a flag, why don't you just call a method from the if/else block above?