Changed method to use hashtable instead of js object