Cleanup problems raised in issue #26

chris, please take a look.