Setting error codes for better checking