implement working protocol class code with tests.