refactored protocols#define to two methods for simplicity