Added some better login functionality and fixed issue #6 about error messages.