some overall code quality improvements