Rewriting plugin, added basic support for API.