added plugins
incredible refactotring to support plugins