removed unused checks
used variables for exitcodes
variable for exitcode
fixed codetypo