Refactor connector.rb