Add more error codes, messages and error checking.

Just tell me why it doesn't work and I'll shut up ;)

But I know it's getting late for you, so I'll find that out myself,
don't worry :)