made some changes and figured out why outputstream/inputstream blocks
fixed deadlock issue with output/input stream
fixed deadlock issues