Add preinit and init hooks