Additional tests; minor internal refactor