add sqlite storage for settings
code and api cleanup