Optimize codebase