Implemented a flow test, along with some needed fixes