Code structurized to 2 parts: funtion 'statistics' which does all the work, and main part, which calls 'statistics' function.