code from the shop tin plugin 1.1.2_0