handle processes exit code correctly, refactor UI & code a bit