Added ability for the algotitm to be easily extended to new problems.