Adding validation of return codes