Changed label to button.
Added a check on the validity of data.