Changed some buffers to stack allocation instead of heap