Fixed wrong focus after changing beats on a chord. Moved the beats code to a separate class. Code cleanup.