Added better error codes