add stdin, can be invoked from pipe, small bug on format, need to be fixed later