an implementation of the strategy pattern