Foreign key and UI improvements