Refactored plugins

New PHP and Javascript API