Added beforeRun, afterRun.