More idiomatic F# implementation.