Updated backend to use a database instead of a flat config file (not yet complete). Various other small fixes.