some refactor, ruby style guidelines rubocop