Add more error codes, messages and error checking.

Done, code is indeed shorter. Thank you for explaining yourself with code. :-)

(Earlier I was in a hurry and did not see the right combination at a glance. I ended up being too late for what I had to do, so I might as well have not hurried. Oh well.)

Feel free to merge. :-P