cleaned up linked fields function