modified db tables and added foreien keys