Minor refactoring of tests and warning cleanup