Another update

Overhaul of flag system and some other stuff.