dialog, inputStream to string code refactoring