General code cleanup. Replaced Database queries with table constants.