private void loadConfiguration(String company, String product, Map<String, Object> userOptions, String[] extraOptionsList) {
        optionsList = ArrayUtils.addAll(new String[]{"scheme", "host", "port", "user_agent"}, extraOptionsList);

        options = new HashMap<String, Object>();

        env = (String)userOptions.get("env");

        if (env == null) {
            env = System.getenv(company.toUpperCase() + "_" + product.toUpperCase() + "_ENV");
        }

        if (env == null) {
            env = System.getenv(company.toUpperCase() + "_ENV");
        }

        if (env == null) {
            env = (String)defaultOptions.get("env");
        }

        loadFromHash(userOptions);
        loadFromConfig(company, product, (String)userOptions.get("config"));

        loadFromConfig(company, product, System.getenv(company.toUpperCase() + "_" + product.toUpperCase() + "_CONFIG"));
        loadFromConfig(company, product, System.getenv(company.toUpperCase() + "_CONFIG"));

        loadFromEnv(company.toUpperCase() + "_" + product.toUpperCase());
        loadFromEnv(company.toUpperCase());

        List<String> suffixes = new ArrayList<String>();

        if (env != null) {
            suffixes.add("-" + env);
            suffixes.add("_" + env);
        }

        suffixes.add("");

        for (String suffix : suffixes) {
            for (String configBase : new String[]{company + "-" + product, company + "_" + product, company}) {
                loadFromConfig(company, product, System.getProperty("user.dir") + "/" + configBase + suffix + ".json");
                loadFromConfig(company, product, System.getProperty("user.dir") + "/." + configBase + suffix + ".json");
                loadFromConfig(company, product, System.getProperty("user.dir") + "/config/" + configBase + suffix + ".json");
                loadFromConfig(company, product, System.getProperty("user.dir") + "/config/." + configBase + suffix + ".json");
                loadFromConfig(company, product, System.getProperty("user.home") + "/" + configBase + suffix + ".json");
                loadFromConfig(company, product, System.getProperty("user.home") + "/." + configBase + suffix + ".json");
            }
        }

        loadFromConfig(company, product, (String)defaultOptions.get("config"));
        loadFromHash(defaultOptions);

        projectId = (String)getOption("project_id");
        token = (String)getOption("token");

        if (userOptions.containsKey("cloud")) {
            Object cloudOption = userOptions.get("cloud");
            if(cloudOption != null && cloudOption instanceof Cloud){
                cloud = (Cloud) cloudOption;
            }
        } else {
            cloud = new Cloud((String)getOption("scheme"), (String)getOption("host"), ((Number)getOption("port")).intValue());
        }
    }