Adding editing support for tags, fixing bugs

Changes:
- Fixed some bugs and improved database-related tag code
- Added support for editing tags, including maintaining tag state across previews
- Fixed a bug where the "resources" path was masked by the catchall handler