Fixing #19, #20, #1