Add pre and post stop and start hooks