Simplify return code handling
Minor improvements