Add a base class for Algorithms

Since they are all using the same functionality