Factoring out snake growth code