Major improvements to PE17: it now counts accurately up to 999