Optimized some code.