optimize!
use a boolean flag instead