Added DB logic