Changed strcmp and strcpy to strncmp and strncpy (keep it safe)