refactor using rubocop