added lazy flags logic