Place hook function at the end