Incorporate first pass suggestions and fixes

This patch incorporates the fixes and suggestions received from Ned and
Brian on my previous patch. These will all eventually be rolled into a
single commit, but until the implementation stabilizes it is probably
useful to maintain the original commit history.

Signed-off-by: Prakash Surya <surya1@llnl.gov>