Refactored note detection code into existing classes.