refactor to use keytreeutil