refactor of helper test functions