replaced None check with simple boolean flag