fixes #2 and fixes #3 and fixes #4 and fixes #5 and fixes #6