rubocop and other code quality improvements