Plugin architecture

I have made some changes so that more than 1 plugin can be added by just passing the plugin functions.