Fixes #23 #21 #20 #18