Tidy up so running in production mode works better