fixed value of exit code
improved logging & comments