player tracking added, cleaned some functions