added team functions and some improvements