Remove external code

Using Seq.fold to resolve issue #18