Optimization of a Polarization-Encoding System for Practical Quantum Key Distribution