More functionality and tests for Flag; add missing __init__.py files