added errno.h and error handling to list.c