Various improvements

issue #22
issue #21
issue #19