(off-topic: HasFlag is slower than (x & flag) != 0)