Use `defer` for testing