final update, noticed that psuedo code had product not summation