Use Rubocop and some refactoring