Change static buffer to dinamic