refactored test helper function and added more tests
more test tweaks