updated hash function
fixed case in problem, added swap