Complete function for rectangular flow and improved semantics