Note detection slightly changed, using built-in function. A bit faster