Optimizing some code.