overhauled Settings(implemented in Appsettings), some secruity fixes.