         gutil.log(stdout)
         gutil.log('done')
 
+
+handleRequestError = (err, httpResponse) ->
+    gutil.log('err: ', err)
+    gutil.log('status code: ', httpResponse.statusCode)
+
 LOGIN_URL = 'http://igem.org/Login'
+LOGOUT_URL = 'http://igem.org/cgi/Logout.cgi'
 # Login and call the callback with the cookie jar
 login = (cb) ->
     username = readlineSync.question('Username: ')

                                gutil.log('Successfully uploaded X')
                                fs.writeFileSync('response.html', body)
                            else
                                gutil.log('err: ', err)
                                gutil.log('status code: ', httpResponse.statusCode)
                    else
                        gutil.log('err: ', err)
                        gutil.log('status code: ', httpResponse.statusCode)
            else
                gutil.log('err: ', err)
                gutil.log('status code: ', httpResponse.statusCode)

            logout(jar)


                    jar: jar
                }, (err, httpResponse, body) ->
                    if !err and httpResponse.statusCode is 200
                        gutil.log("Successfully logged in as #{username}")
                        # Pass cookie jar into callback
                        cb(jar)
                    else
                        handleRequestError(err, httpResponse)
            else
                gutil.log('Incorrect username/password')

# **logout**
logout = (jar) ->
    request {
        url: LOGOUT_URL
        jar: jar
    }, (err, httpResponse, body) ->
        if !err and httpResponse.statusCode is 200
            gutil.log('Successfully logged out')
        else
            handleRequestError(err, httpResponse)

# **push**
gulp.task 'push', ->
    login (jar) ->
        request {
            url: 'http://2015.igem.org/Team:Toronto/Team?action=edit'
            jar: jar
        }, (err, httpResponse, body) ->
            if !err and httpResponse.statusCode is 200
                multiform = {
                    wpSection     : ''
                    wpStarttime   : ''
                    wpEdittime    : ''
                    wpScrolltop   : ''
                    wpAutoSummary : ''
                    oldid         : ''
                    wpTextbox1    : ''
                    wpSummary     : ''
                    wpSave        : ''
                    wpEditToken   : ''
                }

