Refactoring code in 'new.rb'