refactor data to to_hash