more cleanup and fixes for issue #8