changed to 32-bit timer for edge counting (not sure if this is better though)