Big change on Update Function: use log(p) instead of p as an input