Some code optimization

Improved code quality