added flags management function