HashMap tests and memory clean up