Ported old beta AI marine code with improved compensation behavior