A bookies worker has been warned he faces jail after scamming his employer out of more than £40,000.
Gavin Thomson, 27, found a glitch in Coral's IT system that allowed him to place bets after events had finished.
He gave friends cash to go into their branches in Dundee and Forfar to put on coupons on sporting events to which he already knew the result, guaranteeing him a winner.
Thomson, of Forfar, has now been told he faces jail after admitting the £40,300 fraud carried out over less than three months.
Fiscal depute Saima Rasheed told Dundee Sheriff Court Thomson was a manager's assistant at the Forfar and Dundee Coral branches when he carried out the scam.
She said: "In the summer of 2015 the accused learned that a glitch in the system enabled him to allow late bets placed by customers.
"He began to ask customers and friends to place bets in the Dundee and Forfar stores on his behalf and he would provide them with stake money."
The scam was uncovered after a regional risk assessor with Coral discovered the IT fault and traced the fraudulent bets to Thomson.
Ms Rasheed told the court the scammer had spent all of his takings on gambling machines and in casinos.
Thomson pleaded guilty on indictment to two charges of fraud committed between October 2015 and January 2016.
Sheriff Alastair Carmichael deferred sentence until September for social work background reports and released Thomson on bail meantime.