Added validation of input