refactored various utility functions called in mine_trees [ci skip]