       client.url  "https://www.hsbc.co.uk/1/3/personal/internet-banking", next
     getListOfAccounts: (next) ->
       console.log "Parsing list of accounts"
-      runJs "accountlist", (err, list) ->
-        console.error err if err
+      runJsFile "accountlist", (err, list) ->
+        if err
+          console.error err
+          return next err
         console.log list
         next()
   , (err) ->

  else
    console.log "Done, result is in `lastResult` variable."

runJs = (filename, callback) ->
  javascript = fs.readFileSync("#{filename}.js").toString('utf8')
  client.execute javascript, [], (err, res) ->
    return callback err if err?
    return callback null, res.value

  # Vanilla JS REPL:
  myRepl = require('repl').start options
  # Export useful things
  myRepl.context[key] = value for key, value of {client, delay, program, echoDone, runJs, runJsFile}
  myRepl.on 'exit', ->
    mainMenu()

