Revised error codes, added client version checking code in the sample code.