Refactoring protocol, using dispatch instead of instanceof