fixing db ref
fixing mailbox ref
fixing indexing
adding makefile