Added units field (incorporated new changes)

My last pull request didn't incorporate some of the recent changes.  This one should be more up to date and easier to merge with the current code.