Using snprintf instead of strcat