Translated code comments to English, some code optimizations