Added error messages

Added some error output when fed bad data. Not yet tested.