implement switchable algorithms - intermediate