Apply offset after applying repetitions (fixes #1)
Add some comments to clarify flow