Sped up by reorganizing loops, replacing assoc-in and update-in with
functions that handle a specific case, and replacing (:kw m) with (get m :kw).
Release 0.3