Error checking and small improvements.

Lib will now throw an error when you're using a wrong username -
password combination.