Refactor code in main.rb and have bug about uploading which response is 401 sometimes.