HIVE-8984: initial refactor