Implemented global setups and teardowns, updated docs.

Also did a number of refactorings which removed duplication in the code.
Merge pull request #49 from sam-falvo/global_setup_teardown

Implemented global setups and teardowns, updated docs.