Change to pointer-based implementation