Added teardown() function, fixed a variety of syntax errors.