Refactored takeMatch functionality in Turns.js