Added team flag and others modifications