Why Do Dogs Sniff Before and After Peeing?

When I wrote "My Doggie Says... Messages from Jamie," I was curious about why Jamie did so much sniffing before peeing.  Was she looking for something?  Was she looking for the absence of something?  Well, there are several on-line articles that answer this question.  Mostly, they are sniffing for other dogs' "marks," so they can "mark over them."  That is, so they can claim the territory for themselves. This probably explains why Jamie would also sniff her way all the way to the end of someone's yard before peeing.  Presumably, because there were no other marks to "mark over." Here is one set of answers. A related question is, "Why do dogs sniff their own urine?"  I've always wondering if they were doing some kind of medical "self-diagnosis," or something like that.  Well, maybe not far off.  Here's an article titled, "Why Does My Dog Smell Its Urine."