Improved note detection method, set debug flag to 0