added result proto message, parsing of result, some refactoring