Rearranged plugins.h functions
wip: Implemented finer grained plugin hooks

issue #445