factorize algorithm class
add color in console