refactor to hash