Debugged flow.jl. Added tests