Change database access pattern, implement actual queue enqueue/dequeue