 md5File = require 'md5-file'
 filedel = require 'filedel'
 fileMove = require 'file-move'
-
-
-# Load config files.
-user = jsonfile.readFileSync './.pickselacc'
-config = jsonfile.readFileSync './picksel.json'
+readline = require 'readline-sync'
+
+
+# Space for config files.
+userPath = './.pickselacc'
+user = null
+configPath = './picksel.json'
+config = null
 
 
 # Initialize logging

    config.images = filteredImages
    persistConfig()
     
     
# Interpret commands.
switch process.argv[2]
  when 'install' then install()
  when 'add' then add process.argv
  when 'remove' then remove process.argv

getResolutionCode = (res) -> humanResolutions.indexOf res


getReader = () =>
  readlineSettings =
    input: process.stdin
    output: process.stdout
  readline.createInterface readlineSettings


persist = (obj, filename) ->
  options =
    spaces: 4
  jsonfile.writeFileSync filename, obj, options
  
  
# Persists the currently loaded configuration settings
#
persistConfig = () -> persist configPath, config


persistUser = () -> persist userPath, user

    
# Returns true if a request to the Pixabay API was successful.
