Also made the input file optional (from stdin)