Implemented headless mode.
Command line handling is bad, and I feel bad. Feel free to replace that mess with something more sophisticated.