Refactor #to_hash methods, add comments