added tests (code from Chris H)