Turned usage into a function and printed after error messages. Also, added checking for tty as first arg after username.