added plugin code, working on demo page
fixed some bugs