made the note count change when buttons are clicked and made code cleaner