enhancing enhanceparams function code