changed malloc to calloc