added stdin and stdout support