Added tests for auditing, and fixed small bugs.