Issue #5 related fix plus few small changes