Partial implementation of a fix for issue #6
Cleanup after 62673d0e5199f20f8fe83d01039bc68e6ab23d7b