added parameters for each variable and included validation