Refactoring. Created abstract superlasses for each algorithm, and added som implementations