refactored to support multiple players