Fixed memory leaks and handled rebalancing... All that's left to do is complete parsing and then can test for real-world inputs.