finally fixed template looping for foreign keys - capability list now shows caps and associated functions