added addOnPreRun and addOnPostRun