Refactor Battle.net API script