Refactor how tags are stored and fix issues with application.