Integrated Wesley's code in ebb/flood split