refactored rect buffer.