implement the hooks