Fixes #2 #4 #5