Hash features

With the help of @yaf clean the `.to_hash` method and tests.