Changed flag system to use enumartion instead.