Refactor flow tables