unused variable, algorithm is not clear for me