added logging to algo