Remove moment dependency, resolves #2
Correctly rewrite functions, resolves #3