fixed hooks priorities + hooks code cleanup