Improved plugin API; Added new test.