Cleanup fixes #13 fixes #16 fixes #9