Various code improvements

see case [#35]