Added a test to assert that toggle was actually created. Some refactorin...

...g around the tests.