adding code for marginalized-function ERP