Add support for non-interactive mode plus a few nits