some small performance improvements

render() is still being called more than necessary. I will continue to
optimize.