Refactored Twitch code