DB logic added