Fixes #3 #4 #5 #7 #8 #9