added popular tags function, and template vars