implemented flag system