split out most harness code to client.js, start on tests. incomplete.