overly complicated code | ScratchStats