Removed tag_table variable
Fixed a minor issue
Made queries slightly more compliant