Implemented hashtable algorithm with loops expanded with step 4.