* Cleaned up the code and fixed a hash bug