Added tests for tagging logic