fixed some bugs, ready for implementing logic to modify tags