put tests in a subdirectory
tweak code for clarity