refactored traffic controller