Updated to use config file and check client-type properly