added language preferences, small refactorings and cleanup