Modularized get_token