added plugin system and preprocessing hooks to api calls