Fixing minimumDuration function