Completes most functionality for flag generation.