Added validation of empty fields.