repository functions and test infrastructure