Some various changes

I changed all the defines to variables for better support, removed some
unnecessary lines, and added a control which allows you to enable and
disable the use of the database. This is good for testing without
database support