HIVE-8792: initial refactor