Add general function to set variables from the frontend