Added cleaning and validatin of input data