refactor protocol class