Refactoring plugin mechanism, adding support for fragments and some other things