Added error statments to insure a working code despit incorrect input