Better error handling and support passwords with spaces in them