Added optional argument to factory. It's going to be used for checkboxes and radio buttons