wrote some code for protocol class