Added AfterFunc, ErrorFunc and BeforeFunc.