This may be written more elegantly as:
`index = index || 0`