SANTUARIO-540 - Optimizing some codes. Thanks to Alanscut <wp_scut@163.com> for the patch. This closes #29.