Fixed bugs in tester and Purchase; wrote documentation.