Various bug fixes batch #1

Ref issue #21

See issue description to see what this PR addresses.

@jaypoulz 
Add a TODO here