cleaning up and betterizing the clojure code