Fix issue #121

Fix issue #121 plus rest of Will's commits