Make flags proper bitfields

Fixes #58.