first draft

Need to run test batteries, eliminate need for global variables.