setStates method updated for two more parameters.