corrected app logic
easier app logic
fixed segfault outputting rcode > 5