Small rewrite to make into a single file, and remove the memory allocation.
Removed unused hashtable function.