Hey Alex,

Let me write this up in Haskell and see if I can corroborate your answers...