rewritten plugin and api client struct