Update readme to include link to header example
Fix loop iteration to endIndex