Second revision

Extracted hash functions and made new class.