Major refactor and addition of tags functionality from Shiny