cleaned up and reorganized territory stuff