added more validation checks