Refactored _get_hash and added some more tests