Improve code for Rubocop