some code for Algorithm class