hash map and other cleanups