WIP on expansion algorithm.
Fix paren imbalance. Thanks Eastwood!