rewrite in pure ClojureScript