Added stdin functionality, still missing ctrl-d exit