revision to flow algorithm