remove config.mode, allow algo to be a function

Fixes #10, #11