Code quality improvements