Algorithm clase became as singleton. Added tests.