Billing with tests

Billing is turned off, but pull request for the billing code, as it now stands.