Facelift, plus fixed a leaky global or 2

@hiltonc