Moved null terminator filling to a separate function