algorithm implementation added