refactoring hive