Small improvements

Some small improvements and prevented NPEs now with better formatting