Added threaded stdin function