change global variables to local

process and dataoutputstream are not shared and are initialized
every time anyway so there is no reason for them to be global
variables.
add break in loop for installed programs

no need to check the whole list if program has been found.