Starting to make unit tests; minor reorganizing