Adding version info, switching to defer for cleanup