db code added - unfinished