Use secret key from config file, create user agent method and more changes