Password support, stronger error checking. Fixes #3