Reduce space complexity.