leap: Adopt functional style

As discussed in #79.
Merge pull request #87 from sjakobi/functional-leap

leap: Adopt functional style