add support for storing settings to sqlite file
code cleanup