Test refactoring

mkstemp?