finish to convert algorithm to be class format