Refactored track id generation