update rhythm function to use arrays