Multiple enhancements

fixes #3 and fixes #6.