Tests moved back to one file. Minor refactoring.