Abstract the algorithm away