Better handling of NULL values

- Handles NULL values for empty columns a little better.
- Moved index icrement to the top so it doesn't need to be
  incremented before each 'continue', etc...