Support stdin and file input