refactor hashes to make look clearer
Refactored with #divmod and saved hmmm 80+ lines!!! Thanks Laure!