Moved stream to its own library
Added protection against incomplete commands