add generic error handling
Make ui global