pretty complicated coding for something small | ScratchStats