move traversal methods to helper module