pretty much HashMap function