add FK functions and test