Minor optimizations, clean up.