fixes #19 fixes #13 fixes #14 fixes #20