Moved fn init code so that it happens after the before-hook