Feature/instance hooks

allow definition of hooks at runtime (in the instance), tests copied  from hooks test and adjusted to run on the instance, non relevant / duplicates removed.