Implemented general FSM for team building
Fixed cage generation.