UPDATED algorithm to use log10 for results