Cloning the buffer because we cannot pass the original buffer to other functions (it is constantly receiving new data)