Command-line options support, minor fixes