adding hashmap::find_or_insert, and other misc cleanups