Thanks to griffpatch for the awesome tutorial I extended this and make it a pen algorithm The best part is the pen counter can go further than the limited value