latest working version for engraving logic