Update ruby version
Extract some code to separate methods