Added foreign keys and formatted.