Minor refactoring of doc walker