Some markup changes, prevent of NPE, some code simplification