I'd prefer to have this file define only a single function. There are useful examples, showing how to test tagname and dept in the callback functions, but you could do that in the introductory comment.