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

and minor code cleaning