erase() almost finished

All helper functions have been tested.  Errors have been found and
fixed.  Main loop works with very simple input.  Needs to be tested with
larger inputs.  Compatibility with index.html uncertain at this point.