added getopt + default stdin