Removed scan out of rising and falling functions, it was causing edges to be missed when both were used in the main loop.
Merge remote-tracking branch 'remotes/origin/master'