fixed clojure implementation