3D changes
added buffer management