Add source mapping table and refactor/simplify flow table