Refactored working with protocol