[16] refactored code using rubocop