updated db references

made sure everything uses the config db values, plus a few other fixes
and tidy ups. No password encryption stuff in this commit
OOPS: Didn't mean to leave the config file in

However, there's an example file there instead, if needed.