refactory: oo and hashing