added command line I/O functionality