refactor case code
more work on WAMP testing, add TODO