Refactor hash_syntax.py