Added typechecking for duplicate tags. Added an error message for this.
Added a test to check the correct error is thrown.