refactor modules hooks