preallocation variable to speed up the code and updated doc