core/walker: added more comments, removed code duplication