added a hook for main