init: Move package init code into functions