Changed onset detection to a foldr instead of foldl ~10% performance boost