Move all non-parsing code from parser into client, and fix parser test.