Initial performance fixes. More work to be done.