Add FB Flow type checking
Refactor for clarity and to reduce code duplication