added code to fix #153

There's a couple of issues with this pull request :
  * My python is not great 
  * I haven't written any tests for this feature yet 
  * I'm not sure how you "fix" this issue for stdin without add a new command line arg

But if you could sanity check what I've done so far, and give me some feedback that I'm on the right track that woul be good