A control unit for a milking system, the control unit comprising processing circuitry and interfaces configured to: receive at least one parameter representing at least one measured flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) of milk being extracted from at least one teat of an udder of an animal that is milked via at least one teatcup (111, 112, 113, 114), and based on said at least one parameter control (Ctrl) the extraction of milk to be stopped, wherein the processing circuitry is configured to determine a take-off time (t TO) when the milking shall be stopped based on: a first criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) has reached a decline phase (Ph decl), and a second criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) decreases faster than a threshold slope (s crit 1, s crit 2), the take-off time (t TO) being determined in response to if the second criterion is fulfilled on or after a point in time (t 1) when the first criterion has been fulfilled, and, if the second criterion has not been fulfilled, the processing circuitry is configured to determine the take-off time (t TO) in further response to a third criterion, which is fulfilled if: after that the first criterion has indicated that the flow (f(t)) has reached the decline phase (Ph decl), the flow (f(t)) decreases below a threshold level (F th 1, F th 2), and the processing circuitry is configured to determine that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) has reached the decline phase (Ph decl) based on at least one of: a series of flow values registered during a current milking, and historic milk-flow-profile data (D mfp) for the animal being milked. receive at least one parameter representing at least one measured flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) of milk being extracted from at least one teat of an udder of an animal that is milked via at least one teatcup (111, 112, 113, 114), and based on said at least one parameter control (Ctrl) the extraction of milk to be stopped, wherein the processing circuitry is configured to determine a take-off time (t TO) when the milking shall be stopped based on: a first criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) has reached a decline phase (Ph decl), and a second criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) decreases faster than a threshold slope (s crit 1, s crit 2), a first criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) has reached a decline phase (Ph decl), and a second criterion indicating that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) decreases faster than a threshold slope (s crit 1, s crit 2), the take-off time (t TO) being determined in response to if the second criterion is fulfilled on or after a point in time (t 1) when the first criterion has been fulfilled, and, if the second criterion has not been fulfilled, the processing circuitry is configured to determine the take-off time (t TO) in further response to a third criterion, which is fulfilled if: after that the first criterion has indicated that the flow (f(t)) has reached the decline phase (Ph decl), the flow (f(t)) decreases below a threshold level (F th 1, F th 2), and the processing circuitry is configured to determine that the at least one flow (f(t); (f 1 (t), f 2 (t), f 3 (t), f 4 (t)) has reached the decline phase (Ph decl) based on at least one of: a series of flow values registered during a current milking, and historic milk-flow-profile data (D mfp) for the animal being milked. a series of flow values registered during a current milking, and historic milk-flow-profile data (D mfp) for the animal being milked.