setupBuffers: separate function