Split out function for avoiding merges in Algorithm factory

Continues #485