Added pre and post hooks