Modified the code to use interrupts instead of reading PINC