fixes #1 and closes #7 fixes #2 and fixes #3 and fixes #4 and fixes #5 and fixes #6