diff --git a/.gitignore b/.gitignore
index 1b1cf0b..ec0b196 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,5 +28,3 @@
 
 # Ignore master key for decrypting credentials and more.
 /config/master.key
-
-/config/application.yml
diff --git a/.rubocop.yml b/.rubocop.yml
index d4fb7d5..d1dedf8 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -6,10 +6,13 @@ AllCops:
     - bin/*
   TargetRubyVersion: 2.4
 
+Gemspec/RequiredRubyVersion:
+  Enabled: false
+
 Naming/AccessorMethodName:
   Enabled: false
 
-Lint/RescueWithoutErrorClass:
+Style/RescueStandardError:
   Enabled: false
 
 Metrics/LineLength:
diff --git a/Gemfile b/Gemfile
index 66cc55c..d5d4230 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,8 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
 
 ruby '2.4.1'
 
-gem 'figaro'
-
 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
 gem 'rails', '~> 5.2.0'
 # Use sqlite3 as the database for Active Record
@@ -40,16 +38,16 @@ gem 'bootsnap', '>= 1.1.0', require: false
 
 group :development, :test do
   # Call 'byebug' anywhere in the code to stop execution and get a debugger console
-  gem 'byebug', platforms: %i[mri mingw x64_mingw]
+  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
 end
 
 group :development do
   # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
+  gem 'web-console', '>= 3.3.0'
   gem 'listen', '>= 3.0.5', '< 3.2'
   # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
   gem 'spring'
   gem 'spring-watcher-listen', '~> 2.0.0'
-  gem 'web-console', '>= 3.3.0'
 end
 
 group :test do
@@ -61,4 +59,4 @@ group :test do
 end
 
 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
diff --git a/Gemfile.lock b/Gemfile.lock
index af23ba1..f893f8a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -76,8 +76,6 @@ GEM
     erubi (1.7.1)
     execjs (2.7.0)
     ffi (1.9.25)
-    figaro (1.1.1)
-      thor (~> 0.14)
     globalid (0.4.1)
       activesupport (>= 4.2.0)
     i18n (1.0.1)
@@ -199,7 +197,6 @@ DEPENDENCIES
   capybara (>= 2.15, < 4.0)
   chromedriver-helper
   coffee-rails (~> 4.2)
-  figaro
   jbuilder (~> 2.5)
   listen (>= 3.0.5, < 3.2)
   puma (~> 3.11)
diff --git a/app/controllers/github_repository_controller.rb b/app/controllers/github_repository_controller.rb
index ef78c7b..92f908a 100644
--- a/app/controllers/github_repository_controller.rb
+++ b/app/controllers/github_repository_controller.rb
@@ -1,11 +1,8 @@
 class GithubRepositoryController < ApplicationController
   def create
     @software = Software.find(params[:software_id])
-
-    if @software.id == params[:repository][:software_id].to_i
-      @repository = GithubRepository.new(params.require(:repository).permit(:software_id, :name))
-      @repository.save
-    end
+    @repository = GithubRepository.new(repository_params)
+    @repository.save
 
     redirect_to edit_software_path(@software)
   end
@@ -13,9 +10,14 @@ class GithubRepositoryController < ApplicationController
   def update
     @software = Software.find(params[:software_id])
     @repository = GithubRepository.find(params[:id])
-
-    @repository.update(params.require(:repository).permit(:name)) if @software.id == @repository.software_id
+    @repository.update(repository_params)
 
     redirect_to edit_software_path(@software)
   end
+
+  private
+
+  def repository_params
+    params.require(:repository).permit(:name, :software_id)
+  end
 end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 6d3fe90..95f2992 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,3 +1,4 @@
 class HomeController < ApplicationController
-  def index; end
+  def index
+  end
 end
diff --git a/app/controllers/softwares_controller.rb b/app/controllers/softwares_controller.rb
index aa0960f..732eb4e 100644
--- a/app/controllers/softwares_controller.rb
+++ b/app/controllers/softwares_controller.rb
@@ -1,6 +1,4 @@
 class SoftwaresController < ApplicationController
-  before_action :find_software, only: %i[show edit update destroy]
-
   def index
     @softwares = Software.all
   end
@@ -9,9 +7,13 @@ class SoftwaresController < ApplicationController
     @software = Software.new
   end
 
-  def show; end
+  def show
+    @software = Software.find(params[:id])
+  end
 
   def edit
+    @software = Software.find(params[:id])
+
     case @software.repository_type
     when 'Github'
       if GithubRepository.exists?(software_id: @software)
@@ -25,8 +27,10 @@ class SoftwaresController < ApplicationController
   end
 
   def update
+    @software = Software.find(params[:id])
+
     if @software.update(software_params)
-      redirect_to edit_software_path(@software)
+      redirect_to @software
     else
       render 'edit'
     end
@@ -36,13 +40,14 @@ class SoftwaresController < ApplicationController
     @software = Software.new(software_params)
 
     if @software.save
-      redirect_to edit_software_path(@software)
+      redirect_to @software
     else
       render 'new'
     end
   end
 
   def destroy
+    @software = Software.find(params[:id])
     @software.destroy
 
     redirect_to softwares_path
@@ -53,8 +58,4 @@ class SoftwaresController < ApplicationController
   def software_params
     params.require(:software).permit(:name, :website, :repository_type)
   end
-
-  def find_software
-    @software = Software.find(params[:id])
-  end
 end
diff --git a/app/models/branch.rb b/app/models/branch.rb
deleted file mode 100644
index adfcb43..0000000
--- a/app/models/branch.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Branch < ApplicationRecord
-  belongs_to :software
-  has_many :versions
-  validates :name, presence: true
-  validates :name, uniqueness: { scope: :software }
-end
diff --git a/app/models/software.rb b/app/models/software.rb
index 3b75797..9b7cc26 100644
--- a/app/models/software.rb
+++ b/app/models/software.rb
@@ -1,4 +1,4 @@
 class Software < ApplicationRecord
-  has_many :branches
+  has_many :versions
   validates :name, presence: true, uniqueness: true
 end
diff --git a/app/models/version.rb b/app/models/version.rb
index 430f761..f9b86db 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -1,6 +1,6 @@
 class Version < ApplicationRecord
-  belongs_to :branch
+  belongs_to :software
   validates :number, presence: true
   validates :date, presence: true
-  validates :number, uniqueness: { scope: :branch }
+  validates :number, uniqueness: { scope: :software }
 end
diff --git a/app/views/softwares/show.html.erb b/app/views/softwares/show.html.erb
index badad6d..086626c 100644
--- a/app/views/softwares/show.html.erb
+++ b/app/views/softwares/show.html.erb
@@ -5,8 +5,6 @@
   <%= link_to 'Delete', software_path(@software), method: :delete, class: 'uk-icon-link', data: { confirm: 'Are you sure?' } %>
 </p>
 <h3><%= @software.name %></h3>
-<% @software.branches.order(name: :desc).each do |branch| %>
-<h4><%= branch.name %></h4>
 <table class="uk-table uk-table-striped">
   <thead>
     <tr>
@@ -14,11 +12,10 @@
       <th>Date</th>
     </tr>
   </thead>
-<% branch.versions.order(date: :desc).each do |version| %>
+<% @software.versions.order(date: :desc).each do |version| %>
   <tr>
     <td><%= version.number %></td>
     <td><%= version.date.strftime('%Y-%m-%d') %></td>
   </tr>
 <% end %>
 </table>
-<% end %>
diff --git a/db/migrate/20180804072602_create_branches.rb b/db/migrate/20180804072602_create_branches.rb
deleted file mode 100644
index b4b292a..0000000
--- a/db/migrate/20180804072602_create_branches.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateBranches < ActiveRecord::Migration[5.2]
-  def change
-    create_table :branches do |t|
-      t.string :name, null: false
-      t.references :software, foreign_key: true
-
-      t.timestamps
-    end
-  end
-end
diff --git a/db/migrate/20180805081706_change_reference_to_version.rb b/db/migrate/20180805081706_change_reference_to_version.rb
deleted file mode 100644
index 1cd8a30..0000000
--- a/db/migrate/20180805081706_change_reference_to_version.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class ChangeReferenceToVersion < ActiveRecord::Migration[5.2]
-  def change
-    remove_reference :versions, :software, index: true, foreign_key: true
-    change_table :versions do |t|
-      t.references :branch, foreign_key: true
-    end
-  end
-end
diff --git a/db/schema.rb b/db/schema.rb
index 3437d27..16c8fe4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,15 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2018_08_05_081706) do
-
-  create_table "branches", force: :cascade do |t|
-    t.string "name", null: false
-    t.integer "software_id"
-    t.datetime "created_at", null: false
-    t.datetime "updated_at", null: false
-    t.index ["software_id"], name: "index_branches_on_software_id"
-  end
+ActiveRecord::Schema.define(version: 2018_07_29_191829) do
 
   create_table "github_repositories", force: :cascade do |t|
     t.string "name", null: false
@@ -34,16 +26,15 @@ ActiveRecord::Schema.define(version: 2018_08_05_081706) do
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
     t.string "repository_type"
-    t.string "branch_pattern"
   end
 
   create_table "versions", force: :cascade do |t|
     t.string "number", null: false
     t.datetime "date", null: false
+    t.integer "software_id"
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
-    t.integer "branch_id"
-    t.index ["branch_id"], name: "index_versions_on_branch_id"
+    t.index ["software_id"], name: "index_versions_on_software_id"
   end
 
 end
diff --git a/lib/tasks/repositories.rake b/lib/tasks/repositories.rake
index c34d336..2573490 100644
--- a/lib/tasks/repositories.rake
+++ b/lib/tasks/repositories.rake
@@ -14,57 +14,42 @@ namespace :repositories do
     end.body
   end
 
-  def branch(software_id, branches, version)
-    name = version.match(/^v?(?<branch>\d+\.\d+)(\.\d+)?$/)[:branch]
-
-    return branches[name] if branches.include?(name)
-
-    branch = Branch.new(
-      name: name,
-      software_id: software_id
-    )
-    branch.save
-    branches[name] = branch.id
-    branch.id
-  end
-
   desc 'Update version from github repositories'
   task github: :environment do
-    headers = {
-      'Accept' => 'application/vnd.github.v3+json'
-    }
-    headers['Authorization'] = "token #{Figaro.env.github_token}" if Figaro.env.github_token
-
     GithubRepository.all.each do |repo|
       begin
         software = Software.find(repo.software_id)
-        branches = software.branches.all.map { |b| [b.name, b.id] }.to_h
-        versions = software.branches.all.map { |b| b.versions.all.map(&:number) }
+        versions = software.versions.all.map(&:number)
+        headers = {
+          'Accept' => 'application/vnd.github.v3+json',
+          'Authorization' => 'token cabbd658df98458404ab519f02bca93bb2923dfb'
+        }
         tags =
           JSON.parse(
             get_url_content(
-              "https://api.github.com/repos/#{repo.name}/tags",
+              "https://api.github.com/repos/#{repo.name}/git/refs/tags",
               headers
             )
           )
 
         tags.each do |tag|
-          next if versions.include?(tag['name'])
+          version = tag['ref'].split('/').last
+          next if versions.include?(version)
+          puts version
 
-          branch_id = branch(software.id, branches, tag['name'])
           date =
             JSON.parse(
-              get_url_content(tag['commit']['url'], headers)
-            )['commit']['committer']['date']
+              get_url_content(tag['object']['url'], headers)
+            )['committer']['date']
 
-          puts Version.new(
-            branch_id: branch_id,
-            number: tag['name'],
+          Version.new(
+            software_id: software.id,
+            number: version,
             date: date
           ).save
         end
       rescue => e
-        puts e.strace
+        puts e
         next
       end
     end
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index 23701b4..d19212a 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require "test_helper"
 
 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
   driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
diff --git a/test/controllers/github_repository_controller_test.rb b/test/controllers/github_repository_controller_test.rb
index 739d87f..7384465 100644
--- a/test/controllers/github_repository_controller_test.rb
+++ b/test/controllers/github_repository_controller_test.rb
@@ -23,7 +23,7 @@ class GithubRepositoryControllerTest < ActionDispatch::IntegrationTest
     assert_not repository.save
   end
 
-  test 'should not save repository if a repository has the same name' do
+  test 'should not save repository if a repository with the same name exist' do
     data = {
       name: 'rails/rails',
       software_id: Software.find_by_name('Kaiho').id
@@ -42,22 +42,4 @@ class GithubRepositoryControllerTest < ActionDispatch::IntegrationTest
 
     assert repository.save
   end
-
-  test 'should not update repository if a repository has the same name' do
-    data = {
-      name: 'rails/rails'
-    }
-    repository = GithubRepository.find_by_name('ruby/ruby')
-
-    assert_not repository.update(data)
-  end
-
-  test 'should update repository' do
-    data = {
-      name: 'rails/rails2'
-    }
-    repository = GithubRepository.find_by_name('rails/rails')
-
-    assert repository.update(data)
-  end
 end
diff --git a/test/fixtures/branches.yml b/test/fixtures/branches.yml
deleted file mode 100644
index 2b98ff0..0000000
--- a/test/fixtures/branches.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
-  name: 1.0
-  software: two 
-
-two:
-  name: 1.1
-  software: two
diff --git a/test/fixtures/github_repositories.yml b/test/fixtures/github_repositories.yml
index 5667993..f420338 100644
--- a/test/fixtures/github_repositories.yml
+++ b/test/fixtures/github_repositories.yml
@@ -3,7 +3,3 @@
 one:
   name: rails/rails
   software: two
-
-two:
-  name: ruby/ruby
-  software: three
diff --git a/test/fixtures/softwares.yml b/test/fixtures/softwares.yml
index 91ee3c9..976f213 100644
--- a/test/fixtures/softwares.yml
+++ b/test/fixtures/softwares.yml
@@ -7,6 +7,3 @@ one:
 two:
   name: Ruby on Rails
   website: https://rubyonrails.org
-
-three:
-  name: Ruby
diff --git a/test/fixtures/versions.yml b/test/fixtures/versions.yml
index b85e83d..597d85b 100644
--- a/test/fixtures/versions.yml
+++ b/test/fixtures/versions.yml
@@ -3,9 +3,9 @@
 one:
   number: 1.0.0
   date: 2018-07-22 20:30:46
-  branch: one
+  software: two
 
 two:
   number: 1.1.0
   date: 2018-12-22 20:30:46
-  branch: two
+  software: two
diff --git a/test/models/branch_test.rb b/test/models/branch_test.rb
deleted file mode 100644
index 629eb34..0000000
--- a/test/models/branch_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class BranchTest < ActiveSupport::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
-end