Move code out of the init function