Catching NPE.
Implemented apply/discard system for settings.
Improved interface for settings.