New live preview mode and small fixes.

Still a work in progress, but it should be working. I'll update the issue when I have time to finish / clean up old code.