Read password from stdin instead of passing it on the command line.
Added some more commenting.