refactor runner and add hooking mechanism