* Added support for group-specific flags

Flags use bitwise operations. Also fixed a couple of global variable
names for uniformity.