Remove algorithm dep

Remove the dependency on the Algorithm library.