Sorted settings alphabetically and broke out db settings from dictionary
Fixed settings.keys() and other small bug fixes