Some refactoring and improvements

Some refactoring and improvements.
Added german translation,