Added persistent preferences and Database support