Fixed error in picking up first note for accompaniment. Refactored Pattern.