Fixes #19, #20, #21