refactored with clojure