for beginners. look at my code | ScratchStats