added invalid input exception catch