added DB logic