added invasion_phase function
added invasion_phase function and moved other function
added TODO comment