Refactored code, added logging and displaying of process output stream