created new function for primary fields, added table-cache