replaces a <div> inside a <a> with a <span>

and minor code cleaning
Merge pull request #1464 from Tuxosaurus/master

replaces a <div> inside a <a> with a <span>