putting in some checks to make sure we don't glue an element more than once.