remake of int0 code
speed counting now seems to work