Refactor and add module hook

Signed-off-by: David Goulet <dgoulet@ev0ke.net>