Hopefully final database edit

all foriegn keys are named uniquely. Also small changes to db.