concluir_res() the wold way (add functions for it to work), several improvements)