Ensure that new objects are inserted in sequence. Fixes out of bounds errors.
Use block-based enumeration rather than a for loop — we use the index,
so this is cleaner.
Merge pull request #2 from tonyarnold/fix-inserts

Ensure that new objects are inserted in sequence. Fixes out of bounds errors.