adds better validation of input