moved algorithms to routines, took out local delegate_to_algorithm