before and after task functions for task