Edited argument parsing, added termination control.