Move resetting of modules to the modules

This adds a hook (module_init) that can either be an iterable or a
callable. if an iterable, it must contain functions which accept a
single parameter (the client instance). If a callable, same story,
except it's just one function.

Note this probably fixes a lot of weird bugs.