Fix bug, update unit tests, clean up code

If a component is on a loop then it cannot be added to any other loop,
even the same loop. This fixes that bug. OS was allowing a component to
be added to two different loops at the same time.

Some tests still fail on clone. This needs to be fixed in a subsequent
commit.