Returned to stream with ugly but stable code. also changed protocol - i save time