Ruby19 compatibility

This is still a work in progress, but seems to get things going for the most part.