implemented error codes
-camoz